/*
 * Bullet.h
 *
 *  Created on: 2012/07/10
 *      Author: Weihe
 */

#ifndef BULLET_H_
#define BULLET_H_

#include "geom.h"
#include "glex.h"
#include "Drawable.h"
#include "Balloon.h"
#include "DrawList.h"
#include "PlaneControl.h"
#include "utility.h"

namespace object {

class Bullet: public Drawable {
	Vector4f position;
	Vector4d front;
	Balloon *target;
	PlaneControl *ctrl;
	static const float speed;
	float distance;
	float endDistance;
public:
	static DrawList *trailList;
	Bullet(Camera *camera, PlaneControl *ctrl, Balloon *target = NULL) :
			Drawable(camera), ctrl(ctrl), target(target) {
		Quaternion q;
		q.angleAxis(nextDouble() * M_PI * 2, camera->frontVector());
		position = camera->position - q * camera->upVector();
		front = camera->frontVector();
		distance = 1;
		endDistance = 800;
	}
	virtual ~Bullet();
	virtual bool update(float dt);
	virtual void draw();
};

} /* namespace object */
#endif /* BULLET_H_ */
